from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import time
from selenium.webdriver import ActionChains # 动作链

driver_path = Service(executable_path='./chromedriver.exe')
options = Options()
options.add_experimental_option("detach",True)
browser = webdriver.Chrome(service=driver_path, options=options)

browser.get('https://www.36kr.com/')

for i in range(1,10):

    # 绝对
    # browser.execute_script(f"window.scrollTo(0, {i}*1000);")
    # time.sleep(0.5)

    # 相对
    # browser.execute_script(f"window.scrollBy(0, {i}*500);")
    # time.sleep(0.5)

    # 直接划到底部
    browser.execute_script(f"window.scrollTo(0, document.body.scrollHeight);")





